using MaterialUI;
using System.Linq;
using UnityEngine;

public class Example10 : MonoBehaviour
{
	[SerializeField]
	private VectorImage m_VectorImage;

	public void OnIconNameButtonClicked()
	{
		m_VectorImage.SetImage(MaterialIconHelper.GetIcon("volume_off"));
	}

	public void OnIconEnumButtonClicked()
	{
		m_VectorImage.SetImage(MaterialIconHelper.GetIcon(MaterialIconEnum.SHOPPING_CART));
	}

	public void OnIconRandomButtonClicked()
	{
		m_VectorImage.SetImage(MaterialIconHelper.GetRandomIcon());
	}

	private ImageData GetIconFromIconFont(string fontName, string iconName)
	{
		VectorImageSet iconSet = VectorImageManager.GetIconSet(fontName);
		Glyph glyph = (from x in iconSet.iconGlyphList
			where x.name.ToLower().Equals(iconName.ToLower())
			select x).FirstOrDefault();
		if (glyph == null)
		{
			UnityEngine.Debug.LogError("Could not find an icon with the name: " + base.name + " inside the " + fontName + " icon font");
			return null;
		}
		Font iconFont = VectorImageManager.GetIconFont(fontName);
		return new ImageData(new VectorImageData(glyph, iconFont));
	}
}
